package com.iman.Confucius.web.common;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.iman.Confucius.domain.SessionBean;
import com.iman.Confucius.domain.User;
import com.iman.Confucius.web.BaseController;
import com.iman.common.util.JsonMapper;

 
@Controller
@RequestMapping(value="/common/*")
public class HeaderController extends BaseController{
	
 
	// 其他的页面模仿我的请求，  返回 "email_suc";  就能显示 jsp页面
	@RequestMapping(value="/header")
	public ModelAndView initjspParamter(HttpServletRequest request){
	
		Map model = new HashMap();
		 
		SessionBean sb = super.getSession(request) ;
		User user = null;
		if(sb!=null){
			user = sb.getUser();
		}
		System.out.println(JsonMapper.toJson( user ));
		ModelAndView view =null;
		view = new ModelAndView("all_head",model);
		view.addObject("user", user);
		putResourceSrc(  view);
		return view;
	}
	
	
	 
	 
}
